<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>

<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<div class="modal-dialog ms-modal-dialog" style="width: 550px;">
  <div class="modal-content">
     
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
      <h4 class="modal-title">新建分区用户</h4>
    </div>
    
      <form class="form-horizontal ms-form form-personal-info" method="POST" action="${ctx.host}/branch-users" data-validate="true">
       
       <div class="modal-body">
         <div class="form-group  ms-form-group">
            <label class="control-label col-xs-3"><span class="text-red">*</span>登录名：</label>
            <div class="col-xs-8 pull-left role-login-name">
              <input type="text" class="form-control" name="loginName" value="" data-validate="required" placeholder="登录名" tabindex="1" autocomplete="off"/>
            </div>
          </div>
          
          <div class="form-group  ms-form-group">
            <label class="control-label col-xs-3"><span class="text-red">*</span>角色：</label>
            <div class="col-xs-8">
              <select class="select2 form-control" name="authority" tabindex="2" data-validate="required"> 
                <option></option>
                <c:forEach items="${roles}" var="role">
                  <option value="${role.code}">${role.name}</option>
                </c:forEach>
              </select>
            </div>
          </div>
          
          <div class="form-group  ms-form-group">
            <label class="control-label col-xs-3"><span class="text-red">*</span>所属分区：</label>
            <div class="col-xs-8">
              <select class="select2 form-control" name="branch" tabindex="3" data-validate="required"> 
                <option></option>
                <c:forEach items="${branches}" var="branch">
                  <option value="${branch.code}">${branch.name}</option>
                </c:forEach>
              </select>
            </div>
          </div>
          
          <div class="form-group  ms-form-group">
            <label class="control-label col-xs-3"><span class="text-red">*</span>姓名：</label>
            <div class="col-xs-8">
              <input type="text" class="form-control" name="name" value="" data-validate="required" tabindex="4" placeholder="姓名" autocomplete="off"/>
            </div>
          </div>
          
          <div class="form-group  ms-form-group">
            <label class="control-label col-xs-3"><span class="text-red">*</span>密码：</label>
            <div class="col-xs-8">
              <input type="password" class="form-control" name="password" data-validate="required" value="" tabindex="5" placeholder="请输入密码" autocomplete="off"/>
            </div>
          </div>
          
          <div class="form-group  ms-form-group">
            <label class="control-label col-xs-3">性别：</label>
            <div class="col-xs-8">
              <select class="select2 form-control" name="gender" tabindex="5"> 
                <option value="男">男</option>
                <option value="女">女</option>
              </select>
            </div>
          </div>
          
          <div class="form-group  ms-form-group">
          <label class="control-label col-xs-3">是否同步vam:</label>
           <div class="col-xs-8">
            <input name="vam" type="checkbox" value="true">
          </div>
        </div>
        
        <div class="form-group  ms-form-group vam-user" style="display: none;">
            <label class="control-label col-xs-3">座机号码：</label>
            <div class="col-xs-8">
              <input type="text" class="form-control" name="phone" data-validate="phone" tabindex="5" placeholder="请输入座机号码" autocomplete="off"/>
            </div>
          </div>
          
          <div class="form-group  ms-form-group vam-user" style="display: none;">
            <label class="control-label col-xs-3">手机号码：</label>
            <div class="col-xs-8">
              <input type="text" class="form-control" name="mobile" data-validate="mobile" tabindex="5" placeholder="请输入手机号码" autocomplete="off"/>
            </div>
          </div>
          
          <div class="form-group  ms-form-group vam-user" style="display: none;">
            <label class="control-label col-xs-3">电子邮箱：</label>
            <div class="col-xs-8">
              <input type="text" class="form-control" name="email" data-validate="email" tabindex="5" placeholder="请输入电子邮箱" autocomplete="off"/>
            </div>
          </div>
          
          
        </div>
        
	      <div class="modal-footer ms-modal-footer">
	        <button type="submit" class="btn ms-btn btn-primary">确定</button>
	        <button type="button" class="btn ms-btn ms-btn-gary" data-dismiss="modal">取消</button>
	      </div>

      </form>
    
  </div>
</div>

  <script type="text/javascript">
  $(document).ready(function(){
    
    $('select[name="authority"]').select2({
        theme: "classic",
        placeholder : '请选择角色',
        minimumResultsForSearch : -1,
        allowClear : true,
      });
    
    $('select[name="branch"]').select2({
        theme: "classic",
        placeholder : '请选择分区',
        minimumResultsForSearch : -1,
        allowClear : true,
      });
    
    $('select[name="gender"]').select2({
        theme: "classic",
        placeholder : '请选择性别',
        minimumResultsForSearch : -1,
        allowClear : true,
      });
    
  })
  </script>